use std::io::Write;
-use anyhow::{Context, Result, bail};
+use anyhow::{bail, Context, Result};
use clap::Parser;
-use xshell::{Shell, cmd};
+use xshell::{cmd, Shell};
/// Maximum time to wait for SSH to become available (in seconds).
const SSH_TIMEOUT_SECS: u64 = 300;
eprintln!("All {} test plan(s) passed", plans.len());
Ok(())
} else {
- eprintln!(
- "{} of {} plan(s) failed:",
- failures.len(),
- plans.len()
- );
+ eprintln!("{} of {} plan(s) failed:", failures.len(), plans.len());
for (plan, err) in &failures {
eprintln!(" {plan}: {err}");
}
}
/// Run a single TMT plan in a dedicated bcvk VM.
-fn run_plan(
- sh: &Shell,
- args: &RunTmtArgs,
- image: &str,
- plan: &str,
- vm_name: &str,
-) -> Result<()> {
+fn run_plan(sh: &Shell, args: &RunTmtArgs, image: &str, plan: &str, vm_name: &str) -> Result<()> {
// Launch the VM
cmd!(sh, "bcvk libvirt run --name {vm_name} --detach {image}")
.run()
std::thread::sleep(std::time::Duration::from_secs(SSH_POLL_INTERVAL_SECS));
}
- bail!(
- "Timeout waiting for SSH on {vm_name} after {SSH_TIMEOUT_SECS}s"
- );
+ bail!("Timeout waiting for SSH on {vm_name} after {SSH_TIMEOUT_SECS}s");
}
/// Clean up a bcvk VM, ignoring errors.